// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);

// 添加额外的模块解析路径
const path = require('path');
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '..');

// 1. 监视所有文件
config.watchFolders = [workspaceRoot];

// 2. 配置模块解析
config.resolver.nodeModulesPaths = [
  path.resolve(projectRoot, 'node_modules'),
  path.resolve(workspaceRoot, 'node_modules'),
];

// 3. 强制metro模块图包含本地项目
config.resolver.extraNodeModules = {
  'react-native-dlna-player': path.resolve(workspaceRoot, 'src'),
};

module.exports = config;
